package com.ac.app.web.action.org;

import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionMapping;
import com.ac.app.dm.PickOrg;
import com.ac.app.dm.PickRecord;
import com.ac.app.web.form.SearchPickOrgForm;
import com.ac.app.web.view.PickOrgView;
import com.caac.core.Global;
import com.caac.core.config.QueryClass;
import com.caac.core.util.Page;
import com.caac.core.web.action.BaseExportAction;
import com.caac.core.web.action.ViewForward;
import com.caac.core.web.form.BaseForm;

public class ExportPickOrgAction extends BaseExportAction {
	private static final String QUERY_NAME = "pkOrgQuery";

	private static final String ORDER_NAME = "pkOrgOrder";

	private static final String VIEW_NAME = "pkOrgView2";

	protected ViewForward doViewExecute(ActionMapping mapping, BaseForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		SearchPickOrgForm myForm = (SearchPickOrgForm) form;
		QueryClass qc = getQuery(QUERY_NAME);

		List dmList = getBaseManager().getObjects(PickOrg.class, qc, myForm,
				myForm.isAnd(), getOrder(ORDER_NAME));
		List vList = new ArrayList();
		for (int i = 0; i < dmList.size(); i++) {
			PickOrg dm = (PickOrg) dmList.get(i);
			PickOrgView dmView = new PickOrgView();
			dmView.setDm(dm);
			vList.add(dmView);
		}
		return new ViewForward(forward(mapping), vList,
				getSelViewProps(VIEW_NAME), null, null);

	}

}
